package com.example.day_blog.mapper;

import com.example.day_blog.model.UserInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * @author starsea
 * @date 2024-01-18 12:54
 */
@Mapper
public interface UserInfoMapper {
    //根据用户名，查询用户信息
    @Select("SELECT * FROM blog_spring.user where user_name=#{userName} and delete_flag=0; ")
    UserInfo queryByName(String userName);
    //根据用户id查询用户信息
    @Select("SELECT * FROM blog_spring.user where id=#{id} and delete_flag=0")
    UserInfo queryById(Integer id);
    //创建一个新的用户
    @Insert("insert into user (user_name,password,github_url) values (#{userName},#{password},#{githubUrl})")
    Integer InsertUser(UserInfo userInfo);
}
